#include "ThreadPool.hpp"
#include <memory>

#include "Task.hpp"

int main()
{
    // std::unique_ptr<ThreadPool> tp = std::make_unique<ThreadPool>;//c++14智能指针

    ThreadPool<Task> *tp = new ThreadPool<Task>();
    tp->Init();
    tp->Start();
    int cnt = 10;
    while (cnt--)
    {
        // 不断地像线程池推送任务
        Task t(1, 1);
        tp->Equeue(t);
        sleep(1);
        std::cout << "cnt: " << cnt << std::endl;
    }
    tp->Stop();
    std::cout << "thread pool stop" << std::endl;
    sleep(10);
    return 0;
}
